package com.zr.pojo;

import com.zr.exception.ServiceException;
import lombok.Getter;
import org.joda.time.DateTime;

/**
 * 返回异常结果封装：状态码、异常信息、异常时间
 */
@Getter
public class ExceptionResult {

    private int status;
    private String message;
    private String timestamp;

    public ExceptionResult(ServiceException e) {
        this.status = e.getStatus();
        this.message = e.getMessage();
        this.timestamp = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
    }
}